package day27;

/**
 * 题目：不用加减乘除做加法
 * 题目链接：https://www.nowcoder.com/questionTerminal/59ac416b4b944300b617d4f7f111b215?
 */
public class Main {
    public int Add(int num1,int num2) {
        while(num2 != 0) {
            int a = num1 ^ num2;     //得到相加后不进位的值
            int b = (num1 & num2) << 1 ;   //得到加价后的进位
            num1 = a;
            num2 = b;
        }
        return num1;
    }
}
